package com.chinasofti.framework.net;

import java.lang.reflect.Type;

import com.chinasofti.framework.data.Entity;
import com.chinasofti.framework.net.Request.Action;
import com.chinasofti.framework.parser.XmlParser;

/**
 * @author yaoyang
 *
 * @date 2011-11-23
 */
@SuppressWarnings("rawtypes")
public class RequestParser extends XmlParser<Request>{
	
	@Override
	protected Object getValueFromText(Entity entity, String attrName, Type attrType, String text) {
		
		if(attrType == Action.class) {
			 return Action.valueOf(text);
		}
		
		return  super.getValueFromText(entity, attrName, attrType, text);
	}

	@Override
	protected Request createEntityInstance() {
		return new Request();
	}
}
